
/**
 * created on 2012-05-06
 * @author  qiujz
 * @version 1.0
 *
 * Copyright (c)  Founder Software (Suzhou) Co., Ltd.  2012
 *  All rights reserved.
 *
 * 
 * ================================================================
 * Change Revision
 * ---------------------------------------------------------------
 *    DATE                BY                   COMMENT
 * ---------------------------------------------------------------
 * 2012-05-06         qiujz                Create class
 * 
 *
 * ================================================================
 */	

package com.qjz.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.founder.mh.framework.dao.impl.BaseDaoImpl;
import com.qjz.dao.IHigherGradeDao;
import com.qjz.entity.HigherGradeTo;	

public class HigherGradeDaoImpl extends BaseDaoImpl implements IHigherGradeDao {
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IHigherGradeDao
	 *      #searchHigherGradeList(java.util.Map)
	 */
	public List<HigherGradeTo> searchHigherGradeList(
			Map<String, Object> paramMap) {
		return this.queryForList("higherGrade.searchHigherGrade", paramMap);
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IHigherGradeDao
	 *      #searchHigherGradePagination(java.util.Map, int, int)
	 */
	public List<HigherGradeTo> searchHigherGradePagination(
			Map<String, Object> paramMap, int startRow, int endRow) {
		return this.queryForListPagination("higherGrade.searchHigherGrade",
				paramMap, startRow, endRow);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IHigherGradeDao
	 *      #getHigherGradeCount(java.util.Map)
	 */
	public Integer getHigherGradeCount(Map<String, Object> paramMap) {
		return (Integer) this.queryForObject("higherGrade.getHigherGradeCount", paramMap);
	}
	
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IHigherGradeDao
	 *      #getHigherGradeByPrimaryKey(int)
	 */
	public HigherGradeTo getHigherGradeByPrimaryKey(int hgid) {
		return (HigherGradeTo) queryForObject("higherGrade.getHigherGradeByPrimaryKey", hgid);
	}
	

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IHigherGradeDao
	 *      #insertHigherGrade(com.qjz.entity.HigherGradeTo)
	 */
	public Object insertHigherGrade(HigherGradeTo higherGrade) {
		return this.create("higherGrade.insertHigherGrade", higherGrade);		
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IHigherGradeDao
	 *      #updateHigherGradeByBean(com.qjz.entity.HigherGradeTo)
	 */
	public int updateHigherGradeByBean(HigherGradeTo higherGrade) {
		return this.update("higherGrade.updateHigherGrade.byBean", higherGrade);
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IHigherGradeDao
	 *      #updateHigherGradeByProperty(java.util.Map)
	 */
	public int updateHigherGradeByProperty(Map<String, Object> paramMap) {
		return this.update("higherGrade.updateHigherGrade.byProperty", paramMap);
	}

	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IHigherGradeDao
	 *      #deleteHigherGradeByPrimaryKey(int)
	 */
	public int deleteHigherGradeByPrimaryKey(int hgid) {
		return this.delete("higherGrade.deleteHigherGradeByPrimaryKey", hgid);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IHigherGradeDao
	 *      #deleteHigherGradeBatch(int[])
	 */
	public void deleteHigherGradeBatch(int[] keyArray) {
		SqlMapClient sqlMap = this.getSqlMapClient();
		try {
			sqlMap.startBatch();
			for (int key : keyArray) {
				sqlMap.delete("higherGrade.deleteHigherGradeByPrimaryKey",
						key);
			}
			sqlMap.executeBatch();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	public void deleteHigherGradeByMap(Map<String, Object> paramMap) {
		this.delete("higherGrade.deleteHigherGradeByMap", paramMap);
	}
	
	public List<HigherGradeTo> searchSJQLRList(
			Map<String, Object> paramMap) {
		return this.queryForList("higherGrade.searchSJQLR", paramMap);
	}
		
}	
	
